package com.xxh.securitydemo.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.xxh.securitydemo.dao.UmsAdminDao;
import com.xxh.securitydemo.dao.UmsRoleMenuRelationDao;
import com.xxh.securitydemo.model.UmsAdmin;
import com.xxh.securitydemo.model.UmsMenu;
import com.xxh.securitydemo.model.UmsRoleMenuRelation;
import com.xxh.securitydemo.service.AdminService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;


@Component
public class AdminServiceImpl extends ServiceImpl<UmsAdminDao, UmsAdmin> implements AdminService   {

    @Autowired
    UmsAdminDao umsAdminDao;

    @Override
    public UmsAdmin getAdminByUsername(String username) {
        QueryWrapper<UmsAdmin> wrapper = new QueryWrapper<>();
        wrapper.eq("username",username);
        UmsAdmin one = umsAdminDao.selectOne(wrapper);
        return one;
    }

    public List<UmsMenu> getMenusByUid(long id) {
        return umsAdminDao.getMenusByPrimaryKey(id);
    }
}
